package com.coder.base.controller;

import entity.Result;
import entity.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @BelongsProject:coder_parent
 * @BelongsPackage:com.coder.base.controller
 * @Author:linchong
 * @CreateTime:2018-12-28 14:55
 * @Description:全局统一异常处理类
 */
//@ControllerAdvice
@RestControllerAdvice
public class LabelExceptionHandler {
    @ExceptionHandler(value = Exception.class)
  //  @ResponseBody
    public Result error(Exception e){
        e.printStackTrace();
        return new Result(false, StatusCode.ERROR,e.getMessage());
    }
}
